package com.itxiao.controller;
import com.itxiao.pojo.bo.Page;
import com.itxiao.pojo.bo.spu.AddSpuReq;
import com.itxiao.pojo.vo.R;
import com.itxiao.service.SpuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
 * 商品表(Spu)表控制层
 *
 * @author makejava
 * @since 2025-10-12 17:07:25
 */
@RestController
@RequestMapping("admin/api/v1/spu")
@Api(tags = "商品模块")
@CrossOrigin
public class SpuController {
    @Resource
    private SpuService spuService;

    @ApiOperation("添")
    @PostMapping("/add")
    public R add(@RequestBody AddSpuReq req) {
        return spuService.add(req);
    }

    @ApiOperation("分页查询")
    @PostMapping("/query-list")
    public R queryList(@RequestBody Page page) {
        return spuService.querySpuList(page);
    }
    @ApiOperation("查询商品详情")
    @GetMapping("/query-detail")
    public R queryDetail(Integer id) {
        return spuService.queryDetail(id);
    }
}

